home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIAtom.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  220 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIAtom.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIAtom_h__
  6. #define __gen_nsIAtom_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. #include "nsAString.h"
  18. #include "nsCOMPtr.h"
  19.  
  20. /* starting interface:    nsIAtom */
  21. #define NS_IATOM_IID_STR "3d1b15b0-93b4-11d1-895b-006008911b81"
  22.  
  23. #define NS_IATOM_IID \
  24.   {0x3d1b15b0, 0x93b4, 0x11d1, \
  25.     { 0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81 }}
  26.  
  27. class nsIAtom : public nsISupports {
  28.  public: 
  29.  
  30.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IATOM_IID)
  31.  
  32.   /**
  33.    * Get the Unicode or UTF8 value for the string
  34.    */
  35.   /* AString toString (); */
  36.   NS_IMETHOD ToString(nsAString & _retval) = 0;
  37.  
  38.   /* AUTF8String toUTF8String (); */
  39.   NS_IMETHOD ToUTF8String(nsACString & _retval) = 0;
  40.  
  41.   /**
  42.    * Return a pointer to a zero terminated UTF8 string.
  43.    */
  44.   /* [noscript] void getUTF8String ([shared, retval] out string aResult); */
  45.   NS_IMETHOD GetUTF8String(const char **aResult) = 0;
  46.  
  47.   /**
  48.    * Compare the atom to a specific string value
  49.    * Note that this will NEVER return/throw an error condition.
  50.    */
  51.   /* boolean equals (in AString aString); */
  52.   NS_IMETHOD Equals(const nsAString & aString, PRBool *_retval) = 0;
  53.  
  54.   /* boolean equalsUTF8 (in AUTF8String aString); */
  55.   NS_IMETHOD EqualsUTF8(const nsACString & aString, PRBool *_retval) = 0;
  56.  
  57.   // note this is NOT virtual so this won't muck with the vtable!
  58.   inline PRBool Equals(const nsAString& s) {
  59.     PRBool result;
  60.     Equals(s, &result);
  61.     return result;
  62.   }
  63.   inline PRBool EqualsUTF8(const nsACString& s) {
  64.     PRBool result;
  65.     EqualsUTF8(s, &result);
  66.     return result;
  67.   }
  68. };
  69.  
  70. /* Use this macro when declaring classes that implement this interface. */
  71. #define NS_DECL_NSIATOM \
  72.   NS_IMETHOD ToString(nsAString & _retval); \
  73.   NS_IMETHOD ToUTF8String(nsACString & _retval); \
  74.   NS_IMETHOD GetUTF8String(const char **aResult); \
  75.   NS_IMETHOD Equals(const nsAString & aString, PRBool *_retval); \
  76.   NS_IMETHOD EqualsUTF8(const nsACString & aString, PRBool *_retval); \
  77.  
  78. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  79. #define NS_FORWARD_NSIATOM(_to) \
  80.   NS_IMETHOD ToString(nsAString & _retval) { return _to ToString(_retval); } \
  81.   NS_IMETHOD ToUTF8String(nsACString & _retval) { return _to ToUTF8String(_retval); } \
  82.   NS_IMETHOD GetUTF8String(const char **aResult) { return _to GetUTF8String(aResult); } \
  83.   NS_IMETHOD Equals(const nsAString & aString, PRBool *_retval) { return _to Equals(aString, _retval); } \
  84.   NS_IMETHOD EqualsUTF8(const nsACString & aString, PRBool *_retval) { return _to EqualsUTF8(aString, _retval); } \
  85.  
  86. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  87. #define NS_FORWARD_SAFE_NSIATOM(_to) \
  88.   NS_IMETHOD ToString(nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ToString(_retval); } \
  89.   NS_IMETHOD ToUTF8String(nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ToUTF8String(_retval); } \
  90.   NS_IMETHOD GetUTF8String(const char **aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUTF8String(aResult); } \
  91.   NS_IMETHOD Equals(const nsAString & aString, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Equals(aString, _retval); } \
  92.   NS_IMETHOD EqualsUTF8(const nsACString & aString, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EqualsUTF8(aString, _retval); } \
  93.  
  94. #if 0
  95. /* Use the code below as a template for the implementation class for this interface. */
  96.  
  97. /* Header file */
  98. class nsAtom : public nsIAtom
  99. {
  100. public:
  101.   NS_DECL_ISUPPORTS
  102.   NS_DECL_NSIATOM
  103.  
  104.   nsAtom();
  105.  
  106. private:
  107.   ~nsAtom();
  108.  
  109. protected:
  110.   /* additional members */
  111. };
  112.  
  113. /* Implementation file */
  114. NS_IMPL_ISUPPORTS1(nsAtom, nsIAtom)
  115.  
  116. nsAtom::nsAtom()
  117. {
  118.   /* member initializers and constructor code */
  119. }
  120.  
  121. nsAtom::~nsAtom()
  122. {
  123.   /* destructor code */
  124. }
  125.  
  126. /* AString toString (); */
  127. NS_IMETHODIMP nsAtom::ToString(nsAString & _retval)
  128. {
  129.     return NS_ERROR_NOT_IMPLEMENTED;
  130. }
  131.  
  132. /* AUTF8String toUTF8String (); */
  133. NS_IMETHODIMP nsAtom::ToUTF8String(nsACString & _retval)
  134. {
  135.     return NS_ERROR_NOT_IMPLEMENTED;
  136. }
  137.  
  138. /* [noscript] void getUTF8String ([shared, retval] out string aResult); */
  139. NS_IMETHODIMP nsAtom::GetUTF8String(const char **aResult)
  140. {
  141.     return NS_ERROR_NOT_IMPLEMENTED;
  142. }
  143.  
  144. /* boolean equals (in AString aString); */
  145. NS_IMETHODIMP nsAtom::Equals(const nsAString & aString, PRBool *_retval)
  146. {
  147.     return NS_ERROR_NOT_IMPLEMENTED;
  148. }
  149.  
  150. /* boolean equalsUTF8 (in AUTF8String aString); */
  151. NS_IMETHODIMP nsAtom::EqualsUTF8(const nsACString & aString, PRBool *_retval)
  152. {
  153.     return NS_ERROR_NOT_IMPLEMENTED;
  154. }
  155.  
  156. /* End of implementation class template. */
  157. #endif
  158.  
  159. /*
  160.  * The three forms of NS_NewAtom and do_GetAtom (for use with
  161.  * |nsCOMPtr<nsIAtom>|) return the atom for the string given.  At any
  162.  * given time there will always be one atom representing a given string.
  163.  * Atoms are intended to make string comparison cheaper by simplifying
  164.  * it to pointer equality.  A pointer to the atom that does not own a
  165.  * reference is not guaranteed to be valid.
  166.  *
  167.  * The three forms of NS_NewPermanentAtom and do_GetPermanentAtom return
  168.  * the atom for the given string and ensure that the atom is permanent.
  169.  * An atom that is permanent will exist (occupy space at a specific
  170.  * location in memory) until XPCOM is shut down.  The advantage of
  171.  * permanent atoms is that they do not need to maintain a reference
  172.  * count, which requires locking and hurts performance.
  173.  */
  174. /**
  175.  * Find an atom that matches the given UTF-8 string.
  176.  * The string is assumed to be zero terminated.
  177.  */
  178. extern NS_COM nsIAtom* NS_NewAtom(const char* aUTF8String);
  179. extern NS_COM nsIAtom* NS_NewPermanentAtom(const char* aUTF8String);
  180. inline already_AddRefed<nsIAtom> do_GetAtom(const char* aUTF8String)
  181.     { return NS_NewAtom(aUTF8String); }
  182. inline already_AddRefed<nsIAtom> do_GetPermanentAtom(const char* aUTF8String)
  183.     { return NS_NewPermanentAtom(aUTF8String); }
  184.  
  185. /**
  186.  * Find an atom that matches the given UTF-8 string.
  187.  */
  188. extern NS_COM nsIAtom* NS_NewAtom(const nsACString& aUTF8String);
  189. extern NS_COM nsIAtom* NS_NewPermanentAtom(const nsACString& aUTF8String);
  190. inline already_AddRefed<nsIAtom> do_GetAtom(const nsACString& aUTF8String)
  191.     { return NS_NewAtom(aUTF8String); }
  192. inline already_AddRefed<nsIAtom> do_GetPermanentAtom(const nsACString& aUTF8String)
  193.     { return NS_NewPermanentAtom(aUTF8String); }
  194. /**
  195.  * Find an atom that matches the given UTF-16 string.
  196.  * The string is assumed to be zero terminated.
  197.  */
  198. extern NS_COM nsIAtom* NS_NewAtom(const PRUnichar* aUTF16String);
  199. extern NS_COM nsIAtom* NS_NewPermanentAtom(const PRUnichar* aUTF16String);
  200. inline already_AddRefed<nsIAtom> do_GetAtom(const PRUnichar* aUTF16String)
  201.     { return NS_NewAtom(aUTF16String); }
  202. inline already_AddRefed<nsIAtom> do_GetPermanentAtom(const PRUnichar* aUTF16String)
  203.     { return NS_NewPermanentAtom(aUTF16String); }
  204. /**
  205.  * Find an atom that matches the given UTF-16 string.
  206.  */
  207. extern NS_COM nsIAtom* NS_NewAtom(const nsAString& aUTF16String);
  208. extern NS_COM nsIAtom* NS_NewPermanentAtom(const nsAString& aUTF16String);
  209. inline already_AddRefed<nsIAtom> do_GetAtom(const nsAString& aUTF16String)
  210.     { return NS_NewAtom(aUTF16String); }
  211. inline already_AddRefed<nsIAtom> do_GetPermanentAtom(const nsAString& aUTF16String)
  212.     { return NS_NewPermanentAtom(aUTF16String); }
  213. /**
  214.  * Return a count of the total number of atoms currently
  215.  * alive in the system.
  216.  */
  217. extern NS_COM nsrefcnt NS_GetNumberOfAtoms(void);
  218.  
  219. #endif /* __gen_nsIAtom_h__ */
  220.